﻿<template>
  <div>
  </div>
</template>
<script>
import {commonUse_defaultMethod, isPromise, excuteJS, createDownloadLink4Base64, createDownloadLink4BinaryLink} from '../commonUse'
export default {
  components: {},
  props: ['config', 'commonConfig', 'value', 'myData', 'other', 'events', 'isDesignMode', 'pageModel', 'parentModel', 'otherModel', 'pageControl', 'parentControl'],
  created () {},
  mounted () {
    this.init(this.config)
  },
  data () {
    return {
      isInited: false,
      selectedValue: null,
      oriSelectedValue: null,
      showErrMsg: false,
      errMsg: '',
      myConfig: {
        uid: '',
        isRequired: false,
        isShow: true,
        isEnable: true,
        myStyle: {},
        label: '',
        showLabel: false,
        labelSpan: 4,
        dataKey: '',
        allowChild: false,
        children: [],
        other: {}
      }
    }
  },
  computed: {},
  watch: {
    'selectedValue': {
      handler: function (val, oldVal) {
        this.oriSelectedValue = oldVal
        if (this.pageModel && this.pageModel[this.myConfig.dataKey]) {
          this.pageModel[this.myConfig.dataKey].value = val
          this.pageModel[this.myConfig.dataKey].text = this.getText()
        }
        // if (typeof val === 'object') {
        //   console.debug(this.myConfig.dataKey + '=' + JSON.stringify(val))
        // } else {
        //   console.debug(this.myConfig.dataKey + '=' + val)
        // }
        this.$emit('update:value', this.getValue())
        this.$emit('onRuntimeEvent', 'pageModelChange', this.pageModel)
      },
      deep: true
    },
    value: {
      handler: function (val, oldVal) {
        // this.setValue(val)
        this.selectedValue = val
      },
      deep: true
    },
    config: {
      handler: function (val, oldVal) {
        this.isInited = false
        this.init(val)
      },
      deep: true
    }
  },
  methods: {
    isDataComponent () {
      return false
    },
    /**
     * 是否为待校验功能的组件，如果为true，则提交时会使用该组件的校验功能
     */
    isValidComponent () {
      return false
    },
    init (config) {
      if (!this.isInited) {
        Object.assign(this.myConfig, config)
        let self = this
        this.selectedValue = this.value
        if (!self.isDesignMode && self.pageModel && self.isDataComponent()) {
          self.pageModel[self.myConfig.dataKey] = {
            value: self.selectedValue,
            text: self.getText(),
            uid: self.myConfig.uid,
            componentName: self.$options._componentTag,
            component: self
          }
        }
        if (self.isValidComponent && self.otherModel) {
          if (!self.otherModel.validList) {
            self.otherModel.validList = []
          }
          self.otherModel.validList.push(self)
        }
        this.isInited = true
      }
    },
    load (data) {},
    clear () {},
    setValue (val) {
      if (this.selectedValue !== val) {
        this.selectedValue = val
      }
    },
    getValue () {
      return this.selectedValue
    },
    getText () {
      return this.selectedValue
    },
    show () {
      this.myConfig.isShow = true
    },
    hidden () {
      this.myConfig.isShow = false
    },
    enable () {
      this.myConfig.isEnable = true
    },
    disable () {
      this.myConfig.isEnable = false
    },
    isShow () {
      return this.myConfig.isShow
    },
    isEnable () {
      return this.myConfig.isEnable
    },
    isValid () {
      // 必输校验
      if (this.myConfig.isRequired && !this.getValue()) {
        this.errMsg = this.myConfig.label + '不可为空'
        this.showErrMsg = true
        return false
      }
      this.showErrMsg = false
      return true
    },
    onChange () {
      if (this.isDesignMode) return
      if (!this.events.onChange || !this.events.onChange.active) {
        this.$message.error('该组件不支持onChanged事件')
        return
      }
      if (!this.events.onChange.actions || this.events.onChange.actions.length <= 0) {
        return
      }
      this.triggetEvents(this.events.onClick.actions)
      this.$emit('onChange', this.getValue(), this.oriSelectedValue, this.uid)
    },
    onClick (data) {
      if (this.isDesignMode) return
      if (!this.events.onClick || !this.events.onClick.active) {
        this.$message.error('该组件不支持onClick事件')
        return
      }
      if (!this.events.onClick.actions || this.events.onClick.actions.length <= 0) {
        this.$message.error('该组件未设定onClick事件')
        return
      }
      this.triggetEvents(this.events.onClick.actions)
      this.$emit('onClick', data, this.uid)
    },
    onDClick (data) {
      if (this.isDesignMode) return
      if (!this.events.onDClick || !this.events.onDClick.active) {
        this.$message.error('该组件不支持onDClick事件')
        return
      }
      if (!this.events.onDClick.actions || this.events.onDClick.actions.length <= 0) {
        return
      }
      this.triggetEvents(this.events.onClick.actions)
      this.$emit('onDClick', data, this.uid)
    },
    onRowClick (data, index) {
      if (this.isDesignMode) return
      if (!this.events.onRowClick || !this.events.onRowClick.active) {
        this.$message.error('该组件不支持onRowClick事件')
        return
      }
      if (!this.events.onRowClick.actions || this.events.onRowClick.actions.length <= 0) {
        return
      }
      this.triggetEvents(this.events.onRowClick.actions, data)
      this.$emit('onRowClick', data, index, this.uid)
    },
    onRowDClick (data, index) {
      if (this.isDesignMode) return
      if (!this.events.onRowDClick || !this.events.onRowDClick.active) {
        this.$message.error('该组件不支持onRowDClick事件')
        return
      }
      if (!this.events.onRowDClick.actions || this.events.onRowDClick.actions.length <= 0) {
        return
      }
      this.triggetEvents(this.events.onRowDClick.actions, data)
      this.$emit('onRowDClick', data, index, this.uid)
    },
    onSelected (data) {
      if (this.isDesignMode) return
      if (!this.events.onSelected || !this.events.onSelected.active) {
        this.$message.error('该组件不支持onSelected事件')
        return
      }
      if (!this.events.onSelected.actions || this.events.onSelected.actions.length <= 0) {
        return
      }
      this.triggetEvents(this.events.onSelected.actions)
      this.$emit('onSelected', data, this.uid)
    },
    onOperationTrigger (op, data) {
      this.$emit('onOperationTrigger', op, data, this.uid)
    },
    onDesignEvent (event, targetData) {
      this.$emit('onDesignEvent', event, this, targetData)
    },
    triggetEvents (actions, rowData) {
      actions.sort((a, b) => {
        return a.sort - b.sort
      })
      let actionIndex = 0
      let self = this
      let doNextAction = function () {
        if (actionIndex < actions.length) {
          let action = actions[actionIndex]
          actionIndex++
          if (action.action === 'api') {
            self.excuteAPI(action.settings, rowData, doNextAction)
          } else if (action.action === 'pop') {
            self.popPage(action.settings, rowData, doNextAction)
          } else if (action.action === 'redirect') {
            self.redirectPage(action.settings, rowData, doNextAction)
          } else if (action.action === 'script') {
            self.excuteScript(action.settings, rowData, doNextAction)
          } else if (action.action === 'metaAdd') {
            self.excuteMetaInsert(action.settings, doNextAction)
          } else if (action.action === 'metaUpdate') {
            self.excuteMetaUpdate(action.settings, doNextAction)
          } else if (action.action === 'metaDelete') {
            self.excuteMetaDelete(action.settings, rowData, doNextAction)
          } else if (action.action === 'metaRemove') {
            self.excuteMetaRemove(action.settings, rowData, doNextAction)
          } else if (action.action === 'metaRecover') {
            self.excuteMetaRecover(action.settings, rowData, doNextAction)
          } else if (action.action === 'metaSubmit') {
            self.excuteMetaSubmit(action.settings, rowData, doNextAction)
          } else if (action.action === 'metaPass') {
            self.excuteMetaPass(action.settings, rowData, doNextAction)
          } else if (action.action === 'metaReject') {
            self.excuteMetaReject(action.settings, rowData, doNextAction)
          } else if (action.action === 'metaStop') {
            self.excuteMetaStop(action.settings, rowData, doNextAction)
          } else if (action.action === 'metaFinish') {
            self.excuteMetaFinish(action.settings, rowData, doNextAction)
          } else if (action.action === 'metaSaveAndSubmit') {
            self.excuteMetaSaveAndSubmit(action.settings, rowData, doNextAction)
          } else if (action.action === 'close') {
            if (self.parentControl) {
              self.parentControl.showInnerPop = false
            } else {
              self.$router.back()
            }
            doNextAction()
          }
        }
      }
      doNextAction()
    },
    excuteMetaInsert (settings, nextAction) {
      let self = this
      if (settings.meta_uid) {
        const f = () => {
          this.$api.mdFormInsert({
            id: settings.meta_uid,
            data: this.getDataObjFromPageModel()
          }).then(data => {
            if (settings.refreshPage) {
              self.pageControl.refreshPage = true
            }
            if (settings.refreshParentPage) {
              self.parentControl.refreshPage = true
            }
            if (settings.isLoad) {
              self.load()
            }
            if (nextAction) nextAction()
          })
        }
        this.validPage().then(valid => {
          if (valid) {
            f()
          } else {
            this.$message.error('执行失败:页面输入有错，请先修改')
          }
        })
      }
    },
    excuteMetaUpdate (settings, nextAction) {
      let self = this
      if (settings.meta_uid) {
        const f = () => {
          let fixed_data = {}
          settings.fixed_data.forEach(el => {
            fixed_data[el.key] = commonUse_defaultMethod(el.value, self.getDataObjFromPageModel(), null, null, self.parentModel)
          })
          this.$api.mdFormUpdate({
            id: settings.meta_uid,
            data: this.getDataObjFromPageModel(),
            fixed_data_express: fixed_data
          }).then(data => {
            if (settings.refreshPage) {
              self.pageControl.refreshPage = true
            }
            if (settings.refreshParentPage) {
              self.parentControl.refreshPage = true
            }
            if (settings.isLoad) {
              self.load()
            }
            if (nextAction) nextAction()
          })
        }
        this.validPage().then(valid => {
          if (valid) {
            f()
          } else {
            this.$message.error('执行失败:页面输入有错，请先修改')
          }
        })
      }
    },
    excuteMetaDelete (settings, rowData, nextAction) {
      let self = this
      if (settings.meta_uid) {
        self.$confirm('此操作将永久删除, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonClass: 'el-button--info',
          cancelButtonText: '取消'
        }).then(() => {
          let pk = ''
          if (rowData && rowData._default_pk) {
            pk = rowData._default_pk
          } else {
            let modelData = self.getDataObjFromPageModel()
            if (modelData['_default_pk']) {
              pk = modelData['_default_pk']
            }
          }
          self.$api.mdFormDelete(settings.meta_uid, pk).then(data => {
            if (settings.refreshPage) {
              self.pageControl.refreshPage = true
            }
            if (settings.refreshParentPage) {
              self.parentControl.refreshPage = true
            }
            if (settings.isLoad) {
              self.load()
            }
            if (nextAction) nextAction()
          })
        })
      }
    },
    excuteMetaExport (settings, nextAction) {
      let self = this
      let data = this.getDataObjFromPageModel()
      if (settings.meta_uid) {
        let fixed_filter = {}
        let other_condition = {}
        let summary_filter = {}
        let fixed_orderby = {}
        let query_columns = []
        let query_column_header = []
        let summary_columns = []
        settings.fixed_filter.forEach(el => {
          if (el.key) {
            if (!fixed_filter[el.key]) {
              fixed_filter[el.key] = {}
            }
            fixed_filter[el.key][el.op] = commonUse_defaultMethod(el.value, data, null, null, self.parentModel)
          }
        })
        settings.other_condition.forEach(el => {
          if (el.key) {
            if (!other_condition[el.key]) {
              other_condition[el.key] = {}
            }
            other_condition[el.key][el.op] = commonUse_defaultMethod(el.value, data, null, null, self.parentModel)
          }
        })
        settings.summary_filter.forEach(el => {
          if (el.key) {
            if (!summary_filter[el.key]) {
              summary_filter[el.key] = {}
            }
            summary_filter[el.key][el.op] = commonUse_defaultMethod(el.value, data, null, null, self.parentModel)
          }
        })
        settings.fixed_orderby.forEach(el => {
          if (el.key) {
            fixed_orderby[el.key] = el.order
          }
        })
        settings.query_columns.forEach(el => {
          if (el.key && el.is_active) {
            query_columns.push(el.key)
            query_column_header.push(el.header)
          }
        })
        settings.summary_columns.forEach(el => {
          if (el.key && el.is_active) {
            summary_columns.push(el.key)
          }
        })

        self.$api.mdFormExport({
          id: settings.meta_uid,
          summary_column: summary_columns.join(','),
          summary_filter_express: summary_filter,
          query_columns: query_columns.join(','),
          query_column_header: query_column_header.join(','),
          fixed_filter_express: fixed_filter,
          fixed_orderby_express: fixed_orderby,
          other_condition_express: other_condition
        }).then(data => {
          if (nextAction) nextAction()
        })
      }
    },
    excuteMetaRemove (settings, rowData, nextAction) {
      this.doMetaLogicOperation(settings, rowData, '此操作将移除资料, 是否继续?', 'remove', nextAction)
    },
    excuteMetaRecover (settings, rowData, nextAction) {
      this.doMetaLogicOperation(settings, rowData, '此操作将恢复资料, 是否继续?', 'recover', nextAction)
    },
    excuteMetaActive (settings, rowData, nextAction) {
      this.doMetaLogicOperation(settings, rowData, '此操作将启用资料, 是否继续?', 'active', nextAction)
    },
    excuteMetaDeactive (settings, rowData, nextAction) {
      this.doMetaLogicOperation(settings, rowData, '此操作将停用资料, 是否继续?', 'deactive', nextAction)
    },
    excuteMetaSubmit (settings, rowData, nextAction) {
      this.doMetaLogicOperation(settings, rowData, '确认是否提交资料?', 'submit', nextAction)
    },
    excuteMetaPass (settings, rowData, nextAction) {
      this.doMetaLogicOperation(settings, rowData, '确认是否通过?', 'pass', nextAction)
    },
    excuteMetaReject (settings, rowData, nextAction) {
      this.doMetaLogicOperation(settings, rowData, '确认是否驳回?', 'reject', nextAction)
    },
    excuteMetaStop (settings, rowData, nextAction) {
      this.doMetaLogicOperation(settings, rowData, '确认是否终止?', 'stop', nextAction)
    },
    excuteMetaFinish (settings, rowData, nextAction) {
      this.doMetaLogicOperation(settings, rowData, '确认是否完成?', 'finish', nextAction)
    },
    excuteMetaSave (settings, nextAction) {
      let self = this
      if (settings.meta_uid) {
        const f = () => {
          let fixed_data = {}
          settings.fixed_data.forEach(el => {
            fixed_data[el.key] = commonUse_defaultMethod(el.value, self.getDataObjFromPageModel(), null, null, self.parentModel)
          })
          this.$api.mdFormSave({
            id: settings.meta_uid,
            data: this.getDataObjFromPageModel(),
            fixed_data_express: fixed_data
          }).then(data => {
            if (settings.refreshPage) {
              self.pageControl.refreshPage = true
            }
            if (settings.refreshParentPage) {
              self.parentControl.refreshPage = true
            }
            if (settings.isLoad) {
              self.load()
            }
            if (nextAction) nextAction()
          })
        }
        this.validPage().then(valid => {
          if (valid) {
            f()
          } else {
            this.$message.error('执行失败:页面输入有错，请先修改')
          }
        })
      }
    },
    excuteMetaSaveAndSubmit (settings, rowData, nextAction) {
      let self = this
      if (settings.meta_uid) {
        const f = () => {
          let fixed_data = {}
          settings.fixed_data.forEach(el => {
            fixed_data[el.key] = commonUse_defaultMethod(el.value, self.getDataObjFromPageModel(), null, null, self.parentModel)
          })
          this.$api.mdFormSave({
            id: settings.meta_uid,
            data: this.getDataObjFromPageModel(),
            fixed_data_express: fixed_data
          }).then(data => {
            self.$api.mdFormLogicOperation({
              id: settings.meta_uid,
              pk: data['_default_pk']
            }, 'submit').then(data => {
              if (settings.refreshPage) {
                self.pageControl.refreshPage = true
              }
              if (settings.refreshParentPage) {
                self.parentControl.refreshPage = true
              }
              if (settings.isLoad) {
                self.load()
              }
              if (nextAction) nextAction()
            })
          })
        }
        this.validPage().then(valid => {
          if (valid) {
            f()
          } else {
            this.$message.error('执行失败:页面输入有错，请先修改')
          }
        })
      }
    },
    excuteAPI (settings, rowData, nextAction) {
      let self = this
      const f = () => {
        let parameters = {}
        settings.input_header.forEach(el => {
          parameters[el.key] = commonUse_defaultMethod(el.value, self.getDataObjFromPageModel(), null, rowData, self.parentModel)
        })
        settings.input_path.forEach(el => {
          parameters[el.key] = commonUse_defaultMethod(el.value, self.getDataObjFromPageModel(), null, rowData, self.parentModel)
        })
        settings.input_querystring.forEach(el => {
          parameters[el.key] = commonUse_defaultMethod(el.value, self.getDataObjFromPageModel(), null, rowData, self.parentModel)
        })
        settings.input_postdata.forEach(el => {
          parameters[el.key] = commonUse_defaultMethod(el.value, self.getDataObjFromPageModel(), null, rowData, self.parentModel)
        })
        if (settings.method === 'WS') {
          let wsApiRouter = settings.url.slice(1)
          let wsQueryStringArray = []
          let keys = Object.keys(parameters)
          if (keys) {
            keys.forEach(key => {
              wsQueryStringArray.push(key + '=' + parameters[key])
            })
            wsApiRouter = wsApiRouter + '?' + wsQueryStringArray.join('&')
          }
          this.$set(this.pageControl, 'showWS', true)
          this.$set(this.pageControl, 'wsApiRouter', wsApiRouter)
        } else {
          this.$api.excuteDFormEvent(settings.api, rowData, parameters).then(data => {
            if (data && settings.output_dic) {
              settings.output_dic.forEach(el => {
                if (el.key && el.value && self.pageModel[el.key]) {
                  self.pageModel[el.key].component.setValue(commonUse_defaultMethod(el.value, data, null, rowData, self.parentModel))
                }
              })
              if (settings.isDownload) {
                let filename = commonUse_defaultMethod(settings.dl_file_name, data, null, rowData, self.parentModel)
                if (settings.dlType === 'base64') {
                  let filetype = commonUse_defaultMethod(settings.dl_file_type, data, null, rowData, self.parentModel)
                  let filelength = commonUse_defaultMethod(settings.dl_file_length, data, null, rowData, self.parentModel)
                  let filecontent = commonUse_defaultMethod(settings.dl_file_content, data, null, rowData, self.parentModel)
                  createDownloadLink4Base64(filename, filetype, filelength, filecontent)
                } else if (settings.dlType === 'binary') {
                  let filelink = commonUse_defaultMethod(settings.dl_file_link, data, null, rowData, self.parentModel)
                  createDownloadLink4BinaryLink(filelink, filename)
                }
              }
            }
            if (settings.refreshPage) {
              self.pageControl.refreshPage = true
            }
            if (settings.refreshParentPage) {
              self.parentControl.refreshPage = true
            }
            if (settings.isLoad) {
              self.load()
            }
            if (nextAction) nextAction()
          })
        }
      }
      if (settings.isValidPage) {
        this.validPage().then(valid => {
          if (valid) {
            f()
          } else {
            this.$message.error('执行失败:页面输入有错，请先修改')
          }
        })
      } else {
        f()
      }
    },
    popPage (settings, rowData, nextAction) {
      // 内部页面
      if (settings.is_innerPage) {
        this.pageControl.innerPageUid = settings.dform_uid
        this.pageControl.innerRowData = rowData
        this.pageControl.showInnerPop = true
      } else {
        this.pageControl.outPopUrl = settings.target_url
        this.pageControl.showOutPop = true
      }
      if (nextAction) nextAction()
    },
    redirectPage (settings, rowData, nextAction) {
      if (settings.is_innerPage) {
        let path = '/dashboard/dynamicMenu_v2'
        this.$router.push({
          path: path,
          query: {
            uid: settings.dform_uid,
            parentModel: rowData ? this.$Base64.encode(JSON.stringify(rowData)) : this.$Base64.encode(JSON.stringify(this.getDataObjFromPageModel())),
            parentTitle: this.commonConfig.name
          }
        })
      } else {
        window.open(settings.target_url, '_blank')
      }
      if (nextAction) nextAction()
    },
    excuteScript (settings, rowData, nextAction) {
      let js = 'var page=' + JSON.stringify(this.getDataObjFromPageModel4Script()) + '\n'
      js += 'var p=' + JSON.stringify(this.parentModel) + '\n'
      js += 'var parent=p\n'
      js += settings.script + '\n'
      js += 'return {page: page}'
      try {
        let re = excuteJS(js)
        let keys = Object.keys(re.page)
        for (let i = 0; i < keys.length; i++) {
          let key = keys[i]
          if (this.pageModel[key] && this.pageModel[key].component) {
            let v = re.page[key]
            this.pageModel[key].component.setValue(v.value)
            if (v.isShow) {
              this.pageModel[key].component.show()
            } else {
              this.pageModel[key].component.hidden()
            }
            if (v.isEnable) {
              this.pageModel[key].component.enable()
            } else {
              this.pageModel[key].component.disable()
            }
            if (v.load) {
              this.pageModel[key].component.load(v.load)
            }
          }
        }
        if (nextAction) nextAction()
      } catch (err) {
        this.$message.error('脚本执行出错:' + err)
      }
    },
    doMetaLogicOperation (settings, rowData, confirmMsg, op, nextAction) {
      let self = this
      let data = this.getDataObjFromPageModel()
      if (settings.meta_uid && data && data['_default_pk']) {
        self.$confirm(confirmMsg, '提示', {
          confirmButtonText: '确定',
          cancelButtonClass: 'el-button--info',
          cancelButtonText: '取消'
        }).then(() => {
          let fixed_data = {}
          let fixed_filter = {}
          settings.fixed_data.forEach(el => {
            fixed_data[el.key] = commonUse_defaultMethod(el.value, data, null, null, self.parentModel)
          })
          settings.fixed_filter.forEach(el => {
            if (el.key) {
              if (!fixed_filter[el.key]) {
                fixed_filter[el.key] = {}
              }
              fixed_filter[el.key][el.op] = commonUse_defaultMethod(el.value, data, null, null, self.parentModel)
            }
          })
          self.$api.mdFormLogicOperation({
            id: settings.meta_uid,
            pk: data['_default_pk'],
            fixed_filter_express: fixed_filter,
            fixed_data_express: fixed_data
          }, op).then(data => {
            if (settings.refreshPage) {
              self.pageControl.refreshPage = true
            }
            if (settings.refreshParentPage) {
              self.parentControl.refreshPage = true
            }
            if (settings.isLoad) {
              self.load()
            }
            if (nextAction) nextAction()
          })
        })
      }
    },
    getDataObjFromPageModel () {
      let rtn = {}
      if (this.pageModel) {
        let keys = Object.keys(this.pageModel)
        for (let i = 0; i < keys.length; i++) {
          rtn[keys[i]] = this.pageModel[keys[i]].value
        }
      }
      return rtn
    },
    getDataObjFromPageModel4Script () {
      let rtn = {}
      if (this.pageModel) {
        let keys = Object.keys(this.pageModel)
        for (let i = 0; i < keys.length; i++) {
          if (!this.pageModel[keys[i]].component) continue
          rtn[keys[i]] = {
            value: this.pageModel[keys[i]].value,
            isShow: this.pageModel[keys[i]].component.isShow(),
            isEnable: this.pageModel[keys[i]].component.isEnable(),
            load: false
          }
        }
      }
      return rtn
    },
    validPage () {
      let arr = []
      if (this.pageModel) {
        let keys = Object.keys(this.pageModel)
        for (let i = 0; i < keys.length; i++) {
          if (!this.pageModel[keys[i]].component) continue
          let v = this.pageModel[keys[i]].component.isValid()
          if (isPromise(v)) {
            arr.push(v)
          } else {
            arr.push(new Promise((resolve, reject) => {
              resolve(v)
            }))
          }
        }
      }
      if (this.otherModel && this.otherModel.validList) {
        for (let i = 0; i < this.otherModel.validList.length; i++) {
          if (!this.otherModel.validList[i]) continue
          let v = this.otherModel.validList[i].isValid()
          if (isPromise(v)) {
            arr.push(v)
          } else {
            arr.push(new Promise((resolve, reject) => {
              resolve(v)
            }))
          }
        }
      }
      return new Promise((resolve, reject) => {
        Promise.all(arr).then(res => {
          const validateResult = res.every(item => !!item)
          resolve(validateResult)
        })
      })
    }
  }
}
</script>
<style></style>
